package com.zegome.uis;

import com.badlogic.gdx.graphics.g2d.TextureRegion;
import com.badlogic.gdx.scenes.scene2d.EventListener;
import com.badlogic.gdx.scenes.scene2d.Group;
import com.badlogic.gdx.scenes.scene2d.ui.Button;
import com.badlogic.gdx.scenes.scene2d.utils.TextureRegionDrawable;

public class ZButton extends Group{

	private Button button;
	
	public ZButton(TextureRegion up, TextureRegion down,TextureRegion checked){
		super();
		button = new Button(new TextureRegionDrawable(up), new TextureRegionDrawable(down), new TextureRegionDrawable(checked));
		this.setOrigin(up.getRegionWidth()/2, up.getRegionHeight()/2);
		this.setTransform(true);
		this.addActor(button);
	}
	
	public ZButton(TextureRegion up, TextureRegion down){
		super();
		button = new Button(new TextureRegionDrawable(up), new TextureRegionDrawable(down));
		this.setOrigin(up.getRegionWidth()/2, up.getRegionHeight()/2);
		this.setTransform(true);
		this.addActor(button);

	}
	
	@Override
	public boolean addListener(EventListener listener) {
		return button.addListener(listener);
	}
	
	public void setChecked(boolean isChecked){
		button.setChecked(isChecked);
	}
	
	public Button getButton(){
		return button;
	}
	
	@Override
	public float getWidth() {
		return button.getWidth();
	}
	
	@Override
	public float getHeight() {
		return button.getHeight();
	}
	
}
